package com.study.结构型模式.代理模式.Cglib代理;

import net.sf.cglib.core.DebuggingClassWriter;

public class Client {


    public static void main(String[] args) {
        System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, "out/cglib");
        //创建目标对象
        TeacherDao teacherDao = new TeacherDao();
        //获取代理对象，并且将目标对象传递给代理对象
        ProxyFactory proxyFactory = new ProxyFactory(teacherDao);
        TeacherDao proxyInstance = (TeacherDao) proxyFactory.getProxyInstance();
        //执行代理对象的方法，触发intercept方法从而实现对目标对象的调用
        proxyInstance.teach();


    }
}
